import { Input, Select } from "antd"
import { FC } from "react"

import { SFormItem } from "@/components/common"
import { useLocale } from "@/locales"
import { notAllowSpecialCharacters } from "@/utils/validate"

const { Option } = Select

interface ParentProxyNameInputProps {
	isHideLabel?: boolean
	onChange?: (text: string) => void
}

const ParentProxyNameInput: FC<ParentProxyNameInputProps> = ({ isHideLabel = false, onChange }) => {
	const { newFormat } = useLocale()
	const selectAfter = (
		<Select defaultValue={isHideLabel ? "" : newFormat("common.top_agent")}>
			<Option value="1">{isHideLabel ? "" : newFormat("common.top_agent")}</Option>
			<Option value="2">所属总代</Option>
		</Select>
	)
	const onNotAllow = (value: string) => {
		onChange && onChange(value)
	}

	return (
		<SFormItem name="parentProxyName">
			{/* <Input
				allowClear
				placeholder={newFormat("common.please_enter")}
				onChange={e => notAllowSpecialCharacters(e, onNotAllow)}
			></Input> */}
			<Input onChange={e => notAllowSpecialCharacters(e, onNotAllow)} addonBefore={selectAfter} />
		</SFormItem>
	)
}

export default ParentProxyNameInput
